fix(pptx): background rendering - gradient inheritance and page fill reset#188
Merged
developer0hye merged 4 commits intoJul 19, 2026
Merged
Conversation
…reset Three PPTX background rendering bugs fixed: 1. resolve_slide_background: gradient background only checked the slide XML, never the layout or master. Solid color already walked the full slide -> layout -> master chain. Extended gradient lookup to follow the same inheritance chain so branded templates with gradients on the layout or master render correctly. 2. generate_fixed_page: when no background is defined, Typst's #set page without a fill inherits the previous page's fill. Slides with no background would show the prior slide's color/gradient. Fixed by explicitly setting fill: white when neither background_color nor background_gradient is present. 3. parse_background_color: only handled bgPr (explicit fill) and ignored bgRef (theme background reference), which is the standard way PowerPoint templates define master backgrounds. Added bgRef parsing so the placeholder color inside bgRef is resolved as the background color. Signed-off-by: nikith-18161 <nikith.molaka@progentys.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com> # Conflicts: # crates/office2pdf/src/parser/pptx_slides.rs
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preserves
nikith-18161's original PR #188 commit while adapting it to currentmain:bgRefmain: explicitly reset a background-less slide to white instead of inheriting the previous Typst page fillThe original contributor commit remains in the PR history. The older gradient and
bgRefchanges were not replayed over the newer, more complete implementation already onmain.The PR base was refreshed to current
mainbefore final validation.Related issue
Related: #188
Testing
cargo test --offline -p office2pdf --test pptx_fixtures pr_188 -- --nocapture— 3 passedcargo test --offline -p office2pdf --lib— 1,204 passed during the focused adaptationcargo test --offline --workspace --quiet— all suites passed, including 1,232 unit tests, 173 DOCX fixtures, 97 PPTX fixtures, 149 XLSX fixtures, 15 CLI tests, and doctestscargo clippy --offline --workspace --all-targets -- -D warningscargo fmt --all -- --checkpython3 -m unittest scripts.tests.test_check_visual_pr— 9 passedVisual impact
Visual audit
fixassets/bugfixes/issue-188/gt.jpgassets/bugfixes/issue-188/before.jpgassets/bugfixes/issue-188/after.jpgRequired inspection
Deviation audit
The 5% fuzz pixel-difference sweep found 11,474 pixels (0.91% of the page). Every cluster is confined to matched text and rounded-border antialiasing edges; it does not indicate a missing, displaced, recolored, clipped, or differently styled element.
Checklist
Signed-off-byline